const initState = {
    roles: [],
    menus: [],
    age: 18,
};
const user = {
    state: {
        roles: [],
        menus: [],
        age: 20,
    },
    mutations: {
        USER_RESET_STATE: (state) => {
            for (let key in initState) {
                state[key] = initState[key];
            }
        },
        SET_ROLES(state, roles) {
            state.roles = roles;
        },
        SET_MENUS(state, menus) {
            state.menus = menus;
        },
        SET_AGE(state, age) {
            state.age = age;
        },
    },
    actions: {
        setRoles({ commit }, roles) {
            commit("SET_ROLES", roles);
        },
        setMenus({ commit }, menus) {
            commit("SET_MENUS", menus);
        },
    },
};

export default user;
